package com.walmart.entity;

import java.math.BigDecimal;

/**
 * 购物栏
 */
public class ShoppingCartItem {
    /**
     * 当前商品
     */
    private Product product;

    /**
     * 当前价格
     */
    private BigDecimal amount;

    /**
     * 当前数量
     */
    private int number;


    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public ShoppingCartItem(Product product, int number) {
        this.product = product;
        this.number = number;
        this.amount = product.getPrice().multiply(BigDecimal.valueOf(number)).multiply(product.getSale());
    }
}
